package com.xique.api.controller;

import com.xique.api.bean.request.ParkApiCarInAndOutRecordListRequest;
import com.xique.api.bean.request.ParkingOrderInfoRequest;
import com.xique.api.bean.request.ReceiveCouponRequest;
import com.xique.api.service.biz.service.IParkApiBizService;
import com.xique.common.core.web.controller.BaseController;
import com.xique.common.core.web.domain.AjaxResult;
import com.xique.common.security.annotation.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 酷玩小镇使用接口
 * @author shd
 * @create 2021/11/11 11:24
 */
@RestController
@RequestMapping("/park")
public class ParkApiController extends BaseController {

    @Autowired
    private IParkApiBizService parkApiBizService;

    /** TODO
     *  含停留时长（进出时间）、车辆来源地（车牌）、实时车位数据（总车位数、剩余车位）
     */

    /**
     * 车位信息
     * @author shd
     * @date 2021/11/16 15:16
     * @return com.xique.common.core.web.domain.AjaxResult
     */
    @GetMapping("/parkingSpaceInfo")
//    @PreAuthorize(hasPermi = "api:park:parkingSpaceInfo")
    public AjaxResult parkingSpaceInfo() {
        return parkApiBizService.getParkingSpaceInfo();
    }

    /**
     * 进出场记录
     * @author shd
     * @date 2021/11/16 13:16
     * @param request
     * @return com.xique.common.core.web.domain.AjaxResult
     */
    @PostMapping("/carInAndOutRecord")
//    @PreAuthorize(hasPermi = "api:park:carInAndOutRecord")
    public AjaxResult carInAndOutRecord(ParkApiCarInAndOutRecordListRequest request) {
        return parkApiBizService.getCarInAndOutRecordList(request);
    }

    @PostMapping("/getParkingOrderInfo")
//    @PreAuthorize(hasPermi = "api:park:getParkingOrderInfo")
    public AjaxResult getParkingOrderInfo(@RequestBody ParkingOrderInfoRequest request) {
        return parkApiBizService.getParkingOrderInfo(request);
    }

    @PostMapping("/receiveCoupon")
//    @PreAuthorize(hasPermi = "api:park:receiveCoupon")
    public AjaxResult receiveCoupon(@RequestBody ReceiveCouponRequest request) {
        return parkApiBizService.receiveCoupon(request);
    }
}
